package com.zhang.mp4;

import java.io.*;
import java.util.ArrayList;
import java.util.Comparator;

public class ConvertMp4 {
    public static void main(String[] args) throws IOException {
        File file = new File("D:\\桌面\\元\\sor");
        ArrayList<File> list = new ArrayList<>();
        File[] files = file.listFiles();
        for (File file1 : files) {
            String name = file1.getName();

            list.add(file1);
        }
        list.sort(new Comparator<File>() {
            @Override
            public int compare(File o1, File o2) {
                return Integer.parseInt(o1.getName())-Integer.parseInt(o2.getName());
            }
        });
        File path = new File("D:\\桌面\\元\\tras\\test.mp4");

        BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(path));
        for (File fileOK : list) {
            byte[] bytes = new byte[1024];

            BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(fileOK));
            while (inputStream.read(bytes) != -1) {
                outputStream.write(bytes);
            }
            inputStream.close();
        }


        outputStream.close();






    }
}
